# demo_app/models.py
# -*- encoding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible

@python_2_unicode_compatible
class Category(models.Model):
    title = models.CharField(_('Title'), max_length=200)

    def __str__(self):
        return self.title

@python_2_unicode_compatible
class Idea(models.Model):
    title = models.CharField(_('Title'), max_length=200)
    category = models.ForeignKey(
        Category,
        verbose_name=_("Category"),
        null=True,
        blank=True,
    )
    categories = models.ManyToManyField(
        Category,
        verbose_name=_("Categories"),
        related_name='ideas',
        blank=True,
    )

    def __str__(self):
        return self.title